// 统一封装接口方法
// 每个方法负责请求一个url地址
// 导入接口方法即可发送请求
// url路径可在此统一管理
import { getToken } from '@/utils/token'
import axios from '@/utils/request.js'

export const getAllChannelsAPI = () => axios({
    url: '/v1_0/channels',
})
export const getLoginAPI = ({ mobile, code }) => axios({
    url: '/v1_0/authorizations',
    method: 'POST',
    data: {
        mobile,
        code
    }
})
export const getUserChannelsAPI = () => axios({
    url: '/v1_0/user/channels',
    headers: {
        Authorization: `Bearer ${getToken()}`
    }
})
export const getArticlesAPI = ({ channel_id, timestamp }) => axios({
    url: '/v1_0/articles',
    headers: {
        Authorization: `Bearer ${getToken()}`
    },
    params: {
        channel_id,
        timestamp
    }
})